package com.yuantong.xyerp.rest.config.APIJson;

import apijson.NotNull;
import apijson.RequestMethod;
import apijson.framework.APIJSONFunctionParser;
import com.alibaba.fastjson.JSONObject;
import com.yuantong.xyerp.XyerpRestApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * Created by Jianguo.Yin on 2021-07-12.
 */
@Component
public class XyerpFunctionParser extends APIJSONFunctionParser {


    public static final String TAG = "XyerpFunctionParser";

//    @Resource
//    private JdbcTemplate jdbcTemplate;



    private XyerpRestApplication xyerpRestApplication;
    public XyerpFunctionParser() {
        this(null, null, 0, null, null);
    }
    public XyerpFunctionParser(RequestMethod method, String tag, int version, JSONObject request, HttpSession session) {
        super(method, tag, version, request, session);
    }

    /***
     * 作用: 测试远程函数是否配置成功
     * @Date 下午3:31 2021/7/19
     **/
    public long getNumber(@NotNull JSONObject request){
        return XyerpBaseModel.getNumber();
    }

    /***
     * 作用: 返回加密后的密码
     * @Date 下午2:46 2021/7/13
     **/
    public String enCrypto(@NotNull JSONObject request, String var1) {
        return XyerpBaseModel.enCrypto(request.getString(var1));
    }

    public boolean test(@NotNull JSONObject request,String amount,String accountId) {

        return XyerpBaseModel.test(request.getDouble(amount),request.getString(accountId));
    }

}
